#ifndef READ_BOY_H__
#define READ_BOY_H__
#include "read_boy_confg.h"
#include "read_boy_base.h"
#include "read_boy_fb.h"
#include "readboy_fount.h"

#include "read_boy_1_54.h"
#include "readboy_epd_2_66a.h"
#include "readboy_epd_2_9_a01.h"
#include "readboy_epd_4_2A.h"
#include "readboy_epd_4_2B.h"
#include "readboy_epd_5_83A.h"

typedef uint8_t c_bmpgif_GRAY8_t[92*81];

extern const c_bmpgif_GRAY8_t *gif[20];
extern const uint8_t c_bmpshanshui01GRAY8[150*150];
extern const uint8_t c_bmpshanshui02GRAY8[150*150];


typedef void drv_init_t(void); //初始化屏幕
typedef void drv_fullpart_t(bool part); //切换慢刷/快刷功能
typedef void drv_dispWriter_t(read_boy_drv_dispWriter_t* f,uint8_t m ); //按照函数刷新
typedef void drv_sleep_t(void) ; //开始屏幕睡眠
typedef void drv_setDepth_t(uint8_t i); //设置显示颜色深度
typedef int  lut_Init_t(const unsigned char* lut);

typedef struct drv_Base_t{
    drv_init_t *drv_init;
    drv_fullpart_t *drv_fullpart;
    drv_sleep_t *drv_sleep;
    drv_setDepth_t *drv_setDepth;
    lut_Init_t *lut_Init;
    drv_dispWriter_t *drv_dispWriter;
    //==================================
    int epdWidth;
    int epdHeight;
    int idleSlowRf;
    int idleFastRf;
    //=============================================
    const unsigned char* lut;
    uint8_t iLut ;
    uint8_t sleeping ;
    //=======2.66a===================================
    uint8_t isBWR; 
    uint8_t greyHQ ; // greyHQ==3 时 为高品质刷新灰度 否则为常规方式刷新灰度
    uint8_t refTime ;
    //uint8_t greyLut ;
    //uint8_t refTime ;
    //======4.2a================================
    uint8_t in_trans ;
    uint8_t _quality  ;//灰度显示品质 默认2 0,2-高品质 1,3-低品质高兼容性. 0,1使用bayer灰度二值表 2,3使用floyd算
    uint32_t lastRefresh;
    //======4.2b==========================
    uint8_t customLut ; //customLut 是灰度刷新时的自定义lut
    uint8_t customGreyscale;
    uint8_t part_mode ;
    //==========5.83==========
    //uint8_t greyscalingHighQuality = 0;
    //==================
    uint8_t epdFull;
    uint8_t GreyScalingHighQuality  ; //是否正在16阶高品质灰度显示
    uint8_t Power_is_on  ; //初始为未上电   //是否上电. 睡眠则设为0
    uint8_t GreyScaling  ; //是否正在灰度显示
#ifdef READGUY_583A_DUAL_BUFFER
  uint8_t *buf_2nd;//=nullptr; //second Buffer for luts
#endif
}drv_Base_t;

extern drv_Base_t my_drv_base;

extern uint16_t FB_WIDTH;// 600
extern uint16_t FB_HEIGHT;

//#if defined(READ_BOY_DEV_154A) 
//#define FB_WIDTH 200
//#define FB_HEIGHT 200
//#endif

//#if defined(READ_BOY_DEV_2_9_A01) 
//#define FB_WIDTH 128
//#define FB_HEIGHT 296
//#endif

//#if defined(READ_BOY_DEV_4_2B) 
//#define FB_WIDTH 400
//#define FB_HEIGHT 300
//#endif

//#if defined(READ_BOY_DEV_5_83A) 
//#define FB_WIDTH 600
//#define FB_HEIGHT 448
//#endif

typedef enum read_boy_epd_type{
    READ_BOY_EPD_1_54,
    READ_BOY_EPD_2_66A,
    READ_BOY_EPD_2_9A01,
    READ_BOY_EPD_4_2B,
    READ_BOY_EPD_5_83A
    
}read_boy_epd_type_t;

extern read_boy_epd_type_t read_boy_type;

#ifdef READ_BOY_DEV_154A
#define    my_drv_base_init read_boy_my_drv_base_init_1_54
#endif

#ifdef READ_BOY_DEV_2_66_A
#define    my_drv_base_init read_boy_2_266a_my_drv_base_init
#endif
#ifdef READ_BOY_DEV_2_9_A01
#define    my_drv_base_init read_boy_2_9_a01_my_drv_base_init
#endif

#ifdef READ_BOY_DEV_4_2B
#define    my_drv_base_init read_boy_4_2b_my_drv_base_init
#endif

#ifdef READ_BOY_DEV_5_83A
#define    my_drv_base_init read_boy_5_83a_my_drv_base_init
#endif



 





#endif